# def mt_abs(x):
#         if x>0:
#                 return x
#         else:
#                 return -x
        
# print(mt_abs(-10))

# 一元二次方程
# import math
# def quadratic(a, b, c):
#        Δ=b**2-4*a*c
#        if Δ<0:
#             return '无实数解'
#        elif Δ==0:
#             return -b/2/a
#        else:
#             sqr=math.sqrt(Δ)  
#             return (-b+sqr)/2/a,(-b-sqr)/2/a

# print(quadratic(1, 2, 3))

# def person(name, age, **kw):
#     print('name:', name, 'age:', age, 'other:', kw)

# person('tom',18,city='Beijing',Job='Engineer')
# # person('tom',18)


def mul(*x):
     if len(x) == 0:
          raise TypeError('mul()至少需要一个参数')
     elif len(x) == 1:
          return x[0]
     else:
          y = 1
          for i in x:
               y = y * i
          return y

# 测试
print('mul(5) =', mul(5))
print('mul(5, 6) =', mul(5, 6))
print('mul(5, 6, 7) =', mul(5, 6, 7))
print('mul(5, 6, 7, 9) =', mul(5, 6, 7, 9))
if mul(5) != 5:
    print('mul(5)测试失败!')
elif mul(5, 6) != 30:
    print('mul(5, 6)测试失败!')
elif mul(5, 6, 7) != 210:
    print('mul(5, 6, 7)测试失败!')
elif mul(5, 6, 7, 9) != 1890:
    print('mul(5, 6, 7, 9)测试失败!')
else:
    try:
        mul()
        print('mul()测试失败!')
    except TypeError:
        print('测试成功!')

print('-----------------------------------')

x=(4)
print('-----------------------------------')
for x in x:
     print(x)